const SERVICE = require("../../lib/js/service.js");

Page({
  data:{
    imgUrl: SERVICE.imgUrl,
    certification: ["未认证", "个体认证", "企业认证", "4S店认证", "审核中 ...", "审核不通过"]
  },
  onLoad(){
  },

  onShow(){
    // 获取用户信息
    let _this = this;
    wx.showNavigationBarLoading();
    SERVICE.POST(SERVICE.URL.userInfo, {
      thirdCookie: wx.getStorageSync("thirdCookie")
    }, (status, res) => {
      wx.hideNavigationBarLoading();
      console.log("用户信息:", res);

      if (res.data.status == "success") {
        _this.setData({
          userInfo: res.data
        });
        wx.setStorageSync("userInfo", res.data.user_info);
      } else {
        wx.showToast({
          title: "获取信息失败",
          icon: "none",
          mask: true
        });
      }
    });
  },

  /*分享*/
  onShareAppMessage(){},
  
  /*打电话*/
  ringUp(e) {
    
    wx.showModal({
      content: "400-9999-114",
      confirmColor: "#48BD59",
      success: function (res) {
        if (res.confirm) {
          wx.makePhoneCall({
            phoneNumber: "400-9999-114",
            success: function () {
              console.log("拨打电话成功！")
            },
            fail: function () {
              console.log("拨打电话失败！")
            }
          });
        }
      }
    })

  },
});